<?php 

class Ngos extends Controller{
  
  function Ngos(){
    parent::Controller();
    
    $this->load->scaffolding('ngos'); 
    $this->load->helper(array('form', 'url', 'text' ,'file'));  
       
  }
  
  function index(){
    $data['query'] = $this->db->get('ngos'); 
     
  }
    
  function add(){
  	$this->lang->load('add_ngo', 'english'); 
	$this->load->helper(array('form', 'url'));
	$this->load->library('form_validation');

	# Load variables into the template parser
    $data['title']       = $this->lang->line('title');
    $data['org_name'] = $this->lang->line('org_name'); 
    $data['org_desc'] = $this->lang->line('org_desc'); 
    $data['contact_name'] = $this->lang->line('contact_name'); 
    $data['contact_email'] = $this->lang->line('contact_email'); 
	
	$this->form_validation->set_rules('org_name', $data['org_name'], 'trim|required|max_length[100]|xss_clean');
	$this->form_validation->set_rules('org_desc', $data['org_desc'], 'trim|required|max_length[1000]|xss_clean');
	$this->form_validation->set_rules('contact_name', $data['contact_name'], 'trim|required|max_length[100]|xss_clean');
	$this->form_validation->set_rules('contact_email', $data['contact_email'],  'trim|required|valid_email|max_length[100]|xss_clean');
	

	if ($this->form_validation->run() == FALSE)
	{
		$this->load->view('add_ngo' , $data );
	}
	else
	{
		
		echo 'SUCCESSS' ;
	}
		
  }
  
  
}

?>